/*
 * Copyright (c) 2017,安徽皖通科技股份有限公司 All rights reserved.
 */

package com.wttech.dzzf.process.service.upload;

import com.wttech.dzzf.process.constant.ExecuteTable;
import com.wttech.dzzf.process.dao.TransferUserInfoDao;
import com.wttech.dzzf.process.model.UploadRsp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 上传监控服务实现
 *
 * @author MaShibo
 * @date 2017/12/11.
 */
@Service
public class UploadMonitorService {

	private static final Logger LOGGER = LoggerFactory.getLogger(UploadMonitorService.class);

	@Resource
	private TransferUserInfoDao transferUserInfoDao;

	void monitor(ExecuteTable table) {
		try {
			int success = transferUserInfoDao.queryUploadFlagNum(table.getTableName(), UploadRsp.SUCCESS);
			int failure = transferUserInfoDao.queryUploadFlagNum(table.getTableName(), UploadRsp.FAILTURE);
			LOGGER.info("上传数据类型【{}】，上传成功【{}】，上传失败【{}】", new Object[]{table.getStorePath(), success, failure});
		} catch (Exception e) {
			LOGGER.error(e.getMessage(), e);
		}
	}

}
